//
//  NSArray+Ex.m
//  解决数组和字典输出汉字的问题
//
//  Created by 伍银荣 on 2021/9/2.
//  Copyright © 2021 com.WYR. All rights reserved.
//

#import "NSArray+Ex.h"

@interface NSDictionary (Log)
@end


@implementation NSDictionary (Log)

-(NSString *)description {
    NSMutableString *mStr = [NSMutableString string];
    [mStr appendString:@"{\r\n"];
    [self enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
        [mStr appendFormat:@"\t%@ = %@;\r\n",key, obj];
    }];
    [mStr appendString:@"}"];
    return [mStr copy];
}


//-(NSString *)descriptionWithLocale:(id)locale {
//    NSMutableString *mStr = [NSMutableString string];
//    [mStr appendString:@"{\r\n"];
//    [self enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
//        [mStr appendFormat:@"\t%@ = %@;\r\n",key, obj];
//    }];
//    [mStr appendString:@"}"];
//    return [mStr copy];
//}
@end


@implementation NSArray (Ex)
//数组输出中文的问题
//-(NSString *)description {
//    NSMutableString *mStr = [NSMutableString string];
//    [mStr appendString:@"(\r\n"];
//    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
//        [mStr appendFormat:@"\t%@,\r\n",obj];
//    }];
//    [mStr appendString:@")"];
//    return mStr.copy;
//}


-(NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level {
    NSMutableString *mStr = [NSMutableString string];
    [mStr appendString:@"(\r\n"];
    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        [mStr appendFormat:@"\t%@,\r\n",obj];
    }];
    [mStr appendString:@")"];
    return mStr.copy;
}

//-(NSString *)descriptionWithLocale:(id)locale {
//    NSMutableString *mStr = [NSMutableString string];
//    [mStr appendString:@"(\r\n"];
//    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
//        [mStr appendFormat:@"\t%@,\r\n",obj];
//    }];
//    [mStr appendString:@")"];
//    return mStr.copy;
//}

@end





